<!--
 * @Author: White
 * @description: 独家放送
 * @LastEditTime: 2021-08-25 16:51:32
-->

<template>
  <div class="private" :style="{ 'color': theme.text }">
    <div class="private-title">
        <h3>独家放送</h3>
        <i class="el-icon-arrow-right"></i>
    </div>
    <div class="private-content">
        <div class="private-item" v-for="(item, index) in list" :key="index">
            <img :src="item.picUrl" alt="">
            <p>{{item.name}}</p>
        </div>
    </div>
  </div>
</template>

<script>
import { useStore } from 'vuex'
import { reactive, onMounted, computed, toRefs } from 'vue'
import { getPrivate } from '@/api/music'

export default {
  setup () {
    const store = useStore()
    const theme = computed(() => store.state.theme)
    const state = reactive({
      list: []
    })
    onMounted(async () => {
      const res = await getPrivate()
      state.list = res.data.result.splice(0, 4)
    })
    return {
      ...toRefs(state),
      theme
    }
  }
}
</script>

<style lang="scss" scoped>
.private {
  padding: 10px 0px;
  .private-title {
    height: 30px;
    display: flex;
    align-items: center;
    h3 {
      line-height: 30px;
      font-size: 16px;
      font-weight: 700;
      text-decoration: none
    }
  }
  .private-content {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 10px;
    .private-item {
      width: calc(25% - 15px);
      width: 23%;
      margin-right: 10px;
      img {
        width: 100%;
        border-radius: 10px;
      }
      p {
        font-size: 13px;
        font-weight: 400;
        line-height: 20px;
      }
    }
  }
}
</style>
